package com.example.esp8266.Library.RoomLib;

import androidx.room.Entity;
import androidx.room.PrimaryKey;
import androidx.room.ForeignKey;

import java.io.Serializable;

@Entity(tableName = "task_detail",
        foreignKeys = @ForeignKey(entity = Task.class,
                parentColumns = "id",
                childColumns = "taskId",
                onDelete = ForeignKey.CASCADE))
public class TaskDetail implements Serializable {
    @PrimaryKey(autoGenerate = true)
    public int id;

    public int taskId;

    public String command;  // 执行的关键信息，如电器指令
    public String criteria; // 执行条件
    private int delay; // 延迟参数

    // 默认构造函数
    public TaskDetail() {}

    // 便于创建对象的构造函数
    public TaskDetail(int taskId, String command, String criteria, int delay) {
        this.taskId = taskId;
        this.command = command;
        this.criteria = criteria;
        this.delay = delay;
    }

    // Getters 和 Setters
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public int getTaskId() {
        return taskId;
    }

    public void setTaskId(int taskId) {
        this.taskId = taskId;
    }

    public String getCommand() {
        return command;
    }

    public void setCommand(String command) {
        this.command = command;
    }

    public String getCriteria() {
        return criteria;
    }

    public void setCriteria(String criteria) {
        this.criteria = criteria;
    }

    public int getDelay() {
        return delay;
    }

    public void setDelay(int delay) {
        this.delay = delay;
    }
}